﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:WpfWizard.Controls">
    
    <!--WIZARD CONTROL-->
    <Controls:NavigationMultiConverter x:Key="navigationMultiConverter" />

    <Style TargetType="Border" x:Key="{x:Static Controls:Wizard.HeaderPanelBorderResourceKey}">
        <Setter Property="Background" Value="#FFFFFF" />
        <Setter Property="BorderBrush" Value="#A0A0A0" />
        <Setter Property="BorderThickness" Value="0,0,0,1" />
        <Setter Property="Padding" Value="5" />
    </Style>

    <Style TargetType="Border" x:Key="{x:Static Controls:Wizard.SideHeaderPanelBorderResourceKey}">
        <Setter Property="Background" Value="#FFFFFF" />
        <Setter Property="BorderBrush" Value="#A0A0A0" />
        <Setter Property="BorderThickness" Value="0,0,1,0" />
    </Style>

    <Style TargetType="Border" x:Key="{x:Static Controls:Wizard.ContentPanelBorderResourceKey}">
        <Setter Property="Background" Value="#FFFFFF" />
    </Style>

    <Style TargetType="Border" x:Key="{x:Static Controls:Wizard.NavigationPanelBorderResourceKey}">
        <Setter Property="Background" Value="#F0F0F0" />
        <Setter Property="BorderBrush" Value="#A0A0A0" />
        <Setter Property="BorderThickness" Value="0,1,0,0" />
        <Setter Property="Padding" Value="7" />
    </Style>

    <Style TargetType="Button" x:Key="{x:Static Controls:Wizard.NavigationButtonResourceKey}">
        <Setter Property="Width" Value="76"/>
        <Setter Property="Height" Value="24" />
    </Style>

    <Style TargetType="{x:Type Controls:Wizard}">
        <Setter Property="Background" Value="#F0F0F0" />
        <Setter Property="BorderBrush" Value="#A0A0A0" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:Wizard}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <!--WIZARD HEADER-->
                            <Border x:Name="HeaderBorder" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="1"
                                    Style="{DynamicResource {ComponentResourceKey ResourceId=HeaderPanelBorderResourceKey, TypeInTargetAssembly={x:Type Controls:Wizard}}}">
                                <ContentControl x:Name="HeaderPresenter" Content="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=ActivePage.Header}" />
                            </Border>

                            <!--WIZARD SIDE HEADER-->
                            <Border x:Name="SideHeaderBorder" Grid.Row="0" Grid.RowSpan="2" Grid.Column="0"
                                    Style="{DynamicResource {ComponentResourceKey ResourceId=SideHeaderPanelBorderResourceKey, TypeInTargetAssembly={x:Type Controls:Wizard}}}">
                                <ContentControl x:Name="SideHeaderPresenter" Content="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=ActivePage.SideHeader}"  />
                            </Border>

                            <!--WIZARD MAIN CONTENT-->
                            <Border Grid.Row="1" Grid.Column="1"
                                    Style="{DynamicResource {ComponentResourceKey ResourceId=ContentPanelBorderResourceKey, TypeInTargetAssembly={x:Type Controls:Wizard}}}">
                                <ContentControl Content="{TemplateBinding ActivePage}"
                                                Margin="{TemplateBinding Padding}" />
                            </Border>

                            <!--WIZARD NAVIGATION-->
                            <Border Grid.Row="2" Grid.ColumnSpan="2" Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationPanelBorderResourceKey, TypeInTargetAssembly={x:Type Controls:Wizard}}}">
                                <Grid>
                                    <Button x:Name="PART_Help" HorizontalAlignment="Left" Content="Help"
                                        Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls:Wizard}}}"
                                        IsEnabled="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=ActivePage.CanHelp}"></Button>

                                    <StackPanel Height="26" Orientation="Horizontal" HorizontalAlignment="Right">
                                        <Button x:Name="PART_Cancel" Content="Cancel" Margin="0,0,7,0"
                                            Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls:Wizard}}}"
                                            IsEnabled="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=ActivePage.CanCancel}"></Button>
                                        <Button x:Name="PART_Previous" Content="Previous" Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls:Wizard}}}">
                                            <Button.IsEnabled>
                                                <MultiBinding Converter="{StaticResource navigationMultiConverter}">
                                                    <Binding RelativeSource="{x:Static RelativeSource.TemplatedParent}" Path="ActivePage.CanNavigatePrevious" />
                                                    <Binding RelativeSource="{x:Static RelativeSource.TemplatedParent}" Path="ActivePage.CanPrevious" />
                                                </MultiBinding>
                                            </Button.IsEnabled>
                                        </Button>
                                        <Button x:Name="PART_Next" Content="Next" Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls:Wizard}}}">
                                            <Button.IsEnabled>
                                                <MultiBinding Converter="{StaticResource navigationMultiConverter}">
                                                    <Binding RelativeSource="{x:Static RelativeSource.TemplatedParent}" Path="ActivePage.CanNavigateNext" />
                                                    <Binding RelativeSource="{x:Static RelativeSource.TemplatedParent}" Path="ActivePage.CanNext" />
                                                </MultiBinding>
                                            </Button.IsEnabled>
                                        </Button>
                                        <Button x:Name="PART_Finish" Content="Finish" Margin="7,0,0,0"
                                            Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls:Wizard}}}"
                                            IsEnabled="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=ActivePage.CanFinish}"></Button>
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger SourceName="SideHeaderPresenter" Property="HasContent" Value="False">
                            <Setter TargetName="SideHeaderBorder" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger SourceName="HeaderPresenter" Property="HasContent" Value="False">
                            <Setter TargetName="HeaderBorder" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--END OF WIZARD CONTROL-->
    
</ResourceDictionary>